
/*jq轮播*/
var lun=function () {
    $(function () {
        var $section=$('#box-container'),
            $lunli = $section.find('.lun > ul > li'),
            len=$lunli.length,
            index=0,
            timer=null;
        //悬停停止轮播，移开继续
        $lunli.hover(function () {
            clearInterval(timer);//清除定时器
        },function () {
            clearInterval(timer);//清除定时器
            timer=setInterval(function () {
                index++;
                index%=len;
                $lunli.eq(index).addClass('on').siblings().removeClass('on')
            },3500)
        })

    })
}

/*jq平滑滚动*/
var lun2=function(){
   $(function () {
       function scroll(){
           $('.Ad-title ul').animate({"margin-left":"-200px"},function () {
               $('.Ad-title ul li:eq(0)').appendTo($('.Ad-title ul'));
               $('.Ad-title ul').css({"margin-left":0});
           })
       }
    setInterval(scroll,5000)
   })

}
/*房间图片切换*/
var lun3=function(){
    $(function () {
        $(function() {
                var $stayWrap = $('.ul-room .stayWrap'),
                $tab = $('.ul-room .tab .item'),
                len = $tab.length,
                $ulWidth = -1020,
                index = 0;

            /* 鼠标移入 */
            $tab.mouseover(function() {
                console.log(1)
                var $this = $(this),
                    index = $this.index();
                $this.addClass('on').siblings().removeClass('on');
                $stayWrap.stop().animate({
                    marginLeft : $ulWidth * index
                })
            })
        })
    })
}
lun();
lun2();
lun3();

